﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GameDb.Entities
{
    public class MatchTurn
    {
        public MatchTurn()
        {
            MatchPlayerTurns = new List<MatchPlayerTurn>();
        }
        public int MatchTurnId { get; set; }
        public short MatchTurnNumber { get; set; }
        public DateTime? StartDate { get; set; }
        public DateTime? CompleteDate { get; set; }

        public virtual GameMatch GameMatch { get; set; }

        public virtual ICollection<MatchPlayerTurn> MatchPlayerTurns { get; set; }
		
		public MatchPlayerTurn CurrentPlayerTurn()
		{
			return MatchPlayerTurns.Where(mt => mt.CompleteDate == null && mt.StartDate != null).Single();
		}
    }
}
